package org.uam.util.lock.dao.impl;

import java.util.Date;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.util.Assert;
import org.uam.util.lock.dao.LockRechargerAS;

/**
 *
 * <一句话功能简述>
 * <功能详细描述>
 *
 * @author  wkf63324
 * @version  [版本号, 2012-3-8]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
public class LockRechargerASImpl extends SqlMapClientDaoSupport implements LockRechargerAS
{
    /**
     * 增加LockRecharger的数据库操作标签:插入订户锁
     */
    private static final String ADD_RECHARGERLOCK = "bin_addRechargerLock";

    /**
     * 增加LockRecharger的数据库操作标签:删除订户被锁定数据
     */
    private static final String DEL_RECHARGERLOCKDATA = "bin_delRechargerLockData";

    /**
     * 增加LockRecharger的数据库操作标签:释放长期被锁定的订户
     */
    private static final String DEL_DELLONGTIMELOCKED = "bin_delLongTimeLockedRec";

    /**
     * {@inheritDoc}
     */
    public void addRechargerLock(String userId, Date lockTime)
    {
        Assert.notNull(userId, "");

        Assert.notNull(lockTime, "");

        getSqlMapClientTemplate().queryForObject(ADD_RECHARGERLOCK);
    }

    /**
     * {@inheritDoc}
     */
    public void deleteRechargerByUserId(String userId)
    {
        Assert.notNull(userId, "");
//
//        List<DataParam> params = new ArrayList<DataParam>();
//        params.add(new DataParam("MSISDN", DataType.STRING, userId));
//
//        new DASTemplate(DEL_RECHARGERLOCKDATA, false).execute(params);
        getSqlMapClientTemplate().queryForObject(DEL_RECHARGERLOCKDATA);
    }

    /**
     * {@inheritDoc}
     */
    public void deleteLongTimeLocked(Date allowedDate)
    {
//        List<DataParam> params = new ArrayList<DataParam>();
//        params.add(new DataParam("ALLOWEDDATE", DataType.TIMESTAMP, allowedDate));
//
//        new DASTemplate(DEL_DELLONGTIMELOCKED, false).execute(params);
        getSqlMapClientTemplate().queryForObject(DEL_DELLONGTIMELOCKED);
    }

}
